package com.nulldev.util.web.flexibleKit.flexRenderer.paths.subgens;

import com.nulldev.util.VariableAPI.ArrayUtils;
import com.nulldev.util.graphics.renderIt.api.renderItGraphicsInterface;
import com.nulldev.util.graphics.renderIt.util.renderPosition;
import com.nulldev.util.web.flexibleKit.flexRenderer.FlexEnvironment;
import com.nulldev.util.web.flexibleKit.flexRenderer.paths.PathGenerator;
import com.nulldev.util.web.flexibleKit.general.RenderOperation;
import com.nulldev.util.web.flexibleKit.jfvParse.Node;

public class LinebreakGenerator implements PathGenerator {

	@Override
	public RenderOperation generate(final Node n, final PathGenerationFlags... flags) {
		return new RenderOperation() {

			@Override
			public renderPosition doRender(final renderItGraphicsInterface iface, final renderPosition rp, final FlexEnvironment imageCache) {
				return rp.setAndResetX();
			}

			@Override
			public Node operationFor() {
				return n;
			}

			@Override
			public boolean keepInline() {
				return ArrayUtils.contains(flags, PathGenerationFlags.RENDER_INLINE);
			}
		};
	}

}
